﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Moq;

namespace QuickTuner
{
    /// <summary>
    /// Provides helper methods to keep the <see cref="Station" /> tests DRY
    /// </summary>
    public static class StationHelper
    {


        private static Random _random;
        public static Random Random { get { return _random ?? (_random = new Random()); } }


        /// <summary>
        /// Creates a default instance of <see cref="Station" />.
        /// </summary>
        public static Station CreateDefaultInstance()
        {
            return new Station();
        }


        /// <summary>
        /// Creates a station with random values.
        /// </summary>
        public static Station CreateRandomStation()
        {
            // TODO: Can this be done without relying on the Station class code?

            var id = Random.Next(1, int.MaxValue);
            var randomTitle = id.ToString();


            var station = new Station() {
                Title = randomTitle,
                StationURL = "http://some.url.com/" + randomTitle
            };

            return station;

        }


        /// <summary>
        /// Make some values of the instance non-default.
        /// i.e. not empty or not the default value.
        /// </summary>
        public static Station ChangeSomeProperties(Station instance)
        {
            instance.Title = "Some new title.";
            instance.StationURL = "http://some.new.url.com/";

            return instance;
        }


    }
}
